<?php

namespace app\admin\model;

use think\Model;
use traits\model\SoftDelete;

class Materialentry extends Model
{

    use SoftDelete;

    protected $pk = 'id';
    // 表名
    protected $name = 'bd_materialentry';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'datetime';
    protected $dateFormat         = 'Y-m-d H:i:s';


    // 定义字段名
    protected $createTime = 'fk_bdl_createtime';
    protected $updateTime = 'fk_bdl_modifytime';
    protected $deleteTime = 'fk_bdl_deletetime';



    public function getfenableList()
    {
        return ["1" => "可用", "0" => "禁用"];
    }


    public function forg()
    {
        return $this->belongsTo('BdOrg', 'forgid');
    }

    public function datacenter()
    {
        return $this->belongsTo('BdDatacenter', 'fk_bdl_bd_datacenter');
    }


    //属性
    public function attribute()
    {
        return $this->hasMany("Matprop", 'id','fk_bdl_bd_matprop');
    }


}
